
#ifndef _DYNAMIC_INT_ARR_
#define _DYNAMIC_INT_ARR_

#ifndef dynamic_int_arr_type
	#define dynamic_int_arr_type int
	#define dynamic_int_arr_type_scan_format "%i"
#endif

#include "../common/error.h"
#include <stdlib.h>
#include <stdio.h>
#include <memory.h>

typedef struct dynamic_int_arr
{
	int capacity;
	int count;
	dynamic_int_arr_type* values;
} dynamic_int_arr;

dynamic_int_arr* dynamic_int_arr__allocate();
dynamic_int_arr* dynamic_int_arr__allocate_capacity(int initial_capacity);
void dynamic_int_arr__grow(dynamic_int_arr* arr);
void dynamic_int_arr__add(dynamic_int_arr* arr, dynamic_int_arr_type value);
void dynamic_int_arr__read_from_stream(dynamic_int_arr* arr, FILE* stream);
void dynamic_int_arr__read_from_file(dynamic_int_arr* arr, const char* filename);
dynamic_int_arr* dynamic_int_arr__create_from_file(const char* filename);
void dynamic_int_arr__free(dynamic_int_arr* arr);

#endif /*  _DYNAMIC_INT_ARR_ */

